<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Audit extends CI_Controller {
	public function index(){
	//kalau sudah ditutup dengan "//"
	//redirect('login');
		
	redirect('audit/sales_bulan');
	}	
	function sales_bulan()
	{
		//kalau sudah ditutup dengan "//"
		//redirect('login');
	
		$this->load->model('Laporan_model');
		$this->load->model('User_model');
		$this->load->model('User_model');
		$this->load->model('Cabang_model');
		$this->load->model('Cm_model');
		$this->load->model('Penjualan_model');
		
		$week = $this->Laporan_model->selectWeek();
		foreach ($week as $g)
		{
			$data['id'][]	 	= $g->id;
			$data['intid_week'][] 	= $g->intid_week;
		}
		//$cabang = $this->User_model->getCabang($this->session->userdata('username'));
        //$nm_cabang = $this->Cabang_model->select($cabang[0]->intid_cabang);

      //  $data['cabang'] = $nm_cabang[0]->strnama_cabang;
		//$data['id_cabang'] = $nm_cabang[0]->intid_cabang;
		$this->load->view('admin_views/laporan/param_sales_bulan', $data);
	}
	function sales_cetak_audit()
	{
		//kalau sudah ditutup dengan "//"
		//redirect('login');
	
		$this->load->model('Laporan_model');
		$this->load->model('User_model');
		$this->load->model('User_model');
		$this->load->model('Cabang_model');
		$this->load->model('Cm_model');
		$this->load->model('Penjualan_model');
		
		$nm_cabang = $this->Cabang_model->select($this->input->post('intid_cabang'));

        $data['cabang'] = $nm_cabang[0]->strnama_cabang;
        $data['id_cabang'] = $nm_cabang[0]->intid_cabang;
		$cabang = $nm_cabang[0]->intid_cabang;
		//echo $this->input->post('intid_month').", ".$this->input->post('intid_cabang');
		
		$data['default'] = $this->Laporan_model->get_CetakSalesAudit($this->input->post('intid_month'),$this->input->post('intid_cabang'));
		$this->load->view('admin_views/laporan/salesbulan', $data);
		
	}
	
}
?>